module.exports = function(app) {

    var isLoggedIn = require('../app/util/authUtil').isLoggedIn;
    var simpleDownUpgradePackageController = require('../app/controller/simpleDownUpgradePackageController');

    var routes_get = ['info'];
    var routes_post = ['query', 'doFinishDeploy', 'doFinishValidate'];

    /**
     * 首页
     */
    app.get('/simpleDownUpgradePackage', isLoggedIn);
    app.get('/simpleDownUpgradePackage', function(req, res) {
        res.render('simpleDownUpgradePackage/index');
    });

    app.get('/simpleDownUpgradePackage/downloadZipFile', function(req, res) {
        simpleDownUpgradePackageController['downloadZipFile'](req, res);
    });

    for (var i = 0; i < routes_get.length; i++) {
        (function(_routeName) {
            app.get('/simpleDownUpgradePackage/' + _routeName, isLoggedIn);
            app.get('/simpleDownUpgradePackage/' + _routeName, function(req, res) {
                simpleDownUpgradePackageController[_routeName](req, res);
            });
        }(routes_get[i]));
    }

    for (var i = 0; i < routes_post.length; i++) {
        (function(_routeName) {
            app.post('/simpleDownUpgradePackage/' + _routeName, isLoggedIn);
            app.post('/simpleDownUpgradePackage/' + _routeName, function(req, res) {
                simpleDownUpgradePackageController[_routeName](req, res);
            });
        }(routes_post[i]));
    }

};